export const initFileSearchField = [{
  "Id": 55,
  "IndexId": 3,
  "IndexFieldName": "filetag",
  "GroupCode": null,
  "IndexFieldType": "string",
  "IndexFieldAnalyzer": "",
  "IndexFieldDesc": "",
  "IndexFieldWeight": 1,
  "IndexFieldStorage": false,
  "IndexFieldKey": true,
  "IndexFieldSort": 0,
  "UserId": 0,
  "CreateTime": "2023-03-29T11:04:56",
  "IsRelatedWord": false,
  "SearchBoost": 1,
  "Subfield": false,
  "IsRelationField": false,
  "RelationField": null
}, {
  "Id": 48,
  "IndexId": 3,
  "IndexFieldName": "filename",
  "GroupCode": null,
  "IndexFieldType": "string",
  "IndexFieldAnalyzer": "",
  "IndexFieldDesc": "",
  "IndexFieldWeight": 1,
  "IndexFieldStorage": false,
  "IndexFieldKey": true,
  "IndexFieldSort": 0,
  "UserId": 0,
  "CreateTime": "2023-03-29T11:04:56",
  "IsRelatedWord": false,
  "SearchBoost": 1,
  "Subfield": false,
  "IsRelationField": false,
  "RelationField": null
}, {
  "Id": 35,
  "IndexId": 3,
  "IndexFieldName": "filecontent",
  "GroupCode": null,
  "IndexFieldType": "string",
  "IndexFieldAnalyzer": "",
  "IndexFieldDesc": "",
  "IndexFieldWeight": 1,
  "IndexFieldStorage": false,
  "IndexFieldKey": true,
  "IndexFieldSort": 0,
  "UserId": 0,
  "CreateTime": "2023-03-29T11:04:56",
  "IsRelatedWord": false,
  "SearchBoost": 1,
  "Subfield": false,
  "IsRelationField": false,
  "RelationField": null
}]
export const initFolderSearchField = [{
  "Id": 72,
  "IndexId": 4,
  "IndexFieldName": "foldername",
  "GroupCode": null,
  "IndexFieldType": "string",
  "IndexFieldAnalyzer": "",
  "IndexFieldDesc": "",
  "IndexFieldWeight": 1,
  "IndexFieldStorage": false,
  "IndexFieldKey": false,
  "IndexFieldSort": 0,
  "UserId": 0,
  "CreateTime": "2023-03-29T11:04:56",
  "IsRelatedWord": false,
  "SearchBoost": 0,
  "Subfield": false,
  "IsRelationField": false,
  "RelationField": null
}]
export const initValue = () => ({
  searchField: [],
  highlightField: [],
  sortField: [],
  vagueSearchField: [],
  excludeField: [],
  columnField: [],
  columnType: 'list',
  showStyle: 'list',
  section: true,
  ckbox: false,
  showSectionIcon: true,
  showfilterNumber: true,
  sectionDisplayPosition: 'top',
  sectionNumber: 3,
  showContents: ['sortField']
  // sectionWidth: 200,
});
export const fileDefaultField = () => [
  {
    IndexFieldName: 'filename',
    IndexFieldDesc: 'SearchResultEngine.fileName',
    notDelete: true,
  },
  {
    IndexFieldName: 'filecreatorname',
    IndexFieldDesc: 'SearchResultEngine.createdBy',
    notDelete: true,
  },
  {
    IndexFieldName: 'filecreatetime',
    IndexFieldDesc: 'SearchResultEngine.creationTime',
    notDelete: true,
  },
  {
    IndexFieldName: 'fileeditorname',
    IndexFieldDesc: 'SearchResultEngine.modifiedBy',
    notDelete: true,
  },
  {
    IndexFieldName: 'filemodifytime',
    IndexFieldDesc: 'SearchResultEngine.modifiedOn',
    notDelete: true,
  },
  {
    IndexFieldName: 'fileextname',
    IndexFieldDesc: 'SearchResultEngine.suffix',
    notDelete: true,
  },
  {
    IndexFieldName: 'filesize',
    IndexFieldDesc: 'SearchResultEngine.fileSize',
    notDelete: true,
  },
];
export const folderDefaultField = () => [
  {
    IndexFieldName: 'foldername',
    IndexFieldDesc: 'SearchResultEngine.folderName',
    notDelete: true,
  },
  {
    IndexFieldName: 'folderpath',
    IndexFieldDesc: 'SearchResultEngine.folderIn',
    notDelete: true,
  },
  {
    IndexFieldName: 'foldercreatorname',
    IndexFieldDesc: 'SearchResultEngine.createdBy',
    notDelete: true,
  },
  {
    IndexFieldName: 'foldereditorname',
    IndexFieldDesc: 'SearchResultEngine.modifiedBy',
    notDelete: true,
  },
  {
    IndexFieldName: 'foldercreatetime',
    IndexFieldDesc: 'SearchResultEngine.creationTime',
    notDelete: true,
  },
  {
    IndexFieldName: 'foldermodifytime',
    IndexFieldDesc: 'SearchResultEngine.modifiedOn',
    notDelete: true,
  },
];

export const crateFileAndfolderLibrary = () => {
  return [{
    IndexName: 'file',
    IndexCode: 'file',
    IndexDesc: '文件',
    IndexType: -1, // 内置
    Id: -1,
    configs: [{
      ...initValue(),
      showContents: ['sortField', 'belongCategory', 'matchtype', 'sourceUser', 'authorityFilter', 'metaData'],
      indexName: '文件',
      tabTitle: 'file',
      defaultSearchCriteria: '*',
      sortField: [
        {
          sort: 'desc',
          enable: true,
          IndexFieldDesc: 'SearchResultEngine.matchingDegree',
          IndexFieldName: '',
          default: true,
        },
      ],
      IndexName: 'file',
      searchField: initFileSearchField,
      vagueSearchField: initFileSearchField,
      columnField: fileDefaultField(),
      columnType: InbizConfig.platform === 'web' ? 'custom' : 'list',
      template:
        InbizConfig.platform === 'web'
          ? {
            name: 'file.jsx',
            content: InbizConfig.PUBLIC_PATH + '/template/file.jsx',
          }
          : undefined,
      sectionType: 'default',
      sectionTemplate: {
        name: 'section.jsx',
        content: InbizConfig.PUBLIC_PATH + '/template_mobile/section.jsx',
      },
    }],

  },
  {
    IndexName: 'folder',
    IndexCode: 'folder',
    IndexDesc: '文件夹',
    IndexType: -1, // 内置
    Id: -1,
    configs: [
      {
        ...initValue(),
        showContents: ['sortField', 'belongCategory', 'sourceUser', 'authorityFilter', 'metaData'],
        indexName: '文件夹',
        tabTitle: 'folder',
        defaultSearchCriteria: '*',
        sortField: [
          {
            sort: 'desc',
            enable: true,
            IndexFieldDesc: 'SearchResultEngine.matchingDegree',
            IndexFieldName: '',
            default: true,
          },
        ],
        IndexName: 'folder',
        searchField: initFolderSearchField,
        vagueSearchField: initFolderSearchField,
        columnField: folderDefaultField(),
        columnType: InbizConfig.platform === 'web' ? 'custom' : 'list',
        template:
          InbizConfig.platform === 'web'
            ? {
              name: 'folder.jsx',
              content: InbizConfig.PUBLIC_PATH + '/template/folder.jsx',
            }
            : undefined,
        sectionType: 'default',
        sectionTemplate: {
          name: 'section.jsx',
          content: InbizConfig.PUBLIC_PATH + '/template_mobile/section.jsx',
        },
      }
    ]
  }]
}
